home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / h / util.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  3.0 KB  |  191 lines

  1. /* util.h: various useful utility definitions */
  2.  
  3. /*
  4.  * @(#) $Header: /xtel/pp/pp-beta/h/RCS/util.h,v 6.0 1991/12/18 20:42:44 jpo Rel $
  5.  *
  6.  * $Log: util.h,v $
  7.  * Revision 6.0  1991/12/18  20:42:44  jpo
  8.  * Release 6.0
  9.  *
  10.  *
  11.  */
  12.  
  13.  
  14.  
  15. #ifndef _H_UTIL
  16. #define _H_UTIL
  17.  
  18.  
  19. /* -- various common defines -- */
  20.  
  21.  
  22. #include <stdio.h>              /* -- minus the ctype stuff -- */
  23. #include <ctype.h>
  24. #include <setjmp.h>
  25. #include <isode/psap.h>
  26. #include <errno.h>
  27. #include "config.h"
  28. #include "ll_log.h"
  29.  
  30. #define PP    60
  31.  
  32. /* -- declarations that should have been in the system files -- */
  33.  
  34. #ifdef SVR4
  35.  
  36. #include <stdlib.h>
  37. #include <string.h>
  38.  
  39. #else
  40. #include <strings.h>
  41. #endif
  42.  
  43. extern char *multcat ();
  44. extern char *multcpy ();
  45. extern char *smalloc ();
  46.  
  47. /* -- some common logical values -- */
  48.  
  49.  
  50. #ifndef TRUE
  51. #define TRUE    1
  52. #endif
  53.  
  54. #ifndef FALSE
  55. #define FALSE   0
  56. #endif
  57.  
  58. #ifndef YES
  59. #define YES     1
  60. #endif
  61.  
  62. #ifndef NO
  63. #define NO      0
  64. #endif
  65.  
  66. #ifndef OK
  67. #define OK      0
  68. #endif
  69.  
  70. #ifndef DONE
  71. #define DONE    1
  72. #endif
  73.  
  74. #ifndef NOTOK
  75. #define NOTOK   -1
  76. #endif
  77.  
  78. #ifndef MORE
  79. #define MORE    2
  80. #endif
  81.  
  82. #ifndef MAYBE
  83. #define MAYBE   1
  84. #endif
  85.  
  86.  
  87. /* -- stdio extensions -- */
  88.  
  89. #ifndef lowtoup
  90. #define lowtoup(chr)            (islower (chr) ? toupper (chr) : chr)
  91. #endif
  92.  
  93. #ifndef  uptolow
  94. #define uptolow(chr)            (isupper (chr) ? tolower (chr) : chr)
  95. #endif
  96.  
  97. #ifndef MIN
  98. #define MIN(a,b)                (( (b) < (a) ) ? (b) : (a) )
  99. #endif
  100.  
  101. #ifndef MAX
  102. #define MAX(a,b)                (( (b) > (a) ) ? (b) : (a) )
  103. #endif
  104.  
  105. #ifndef isstr
  106. #define isstr(ptr)              ((ptr) != 0 && *(ptr) != '\0')
  107. #endif
  108. #ifndef isnull
  109. #define isnull(chr)             ((chr) == '\0')
  110. #endif
  111.  
  112.  
  113.  
  114. /* -- provide a timeout facility -- */
  115.  
  116.  
  117. extern  jmp_buf _timeobuf;
  118.  
  119. #ifndef timeout
  120. #define timeout(val)            (setjmp(_timeobuf) ? 1 : (_timeout(val), 0))
  121. #endif
  122.  
  123.  
  124. /* -- some common extensions -- */
  125.  
  126. #ifndef LINESIZE
  127. #define LINESIZE        512     /* -- max line length -- */
  128. #endif
  129.  
  130. #ifndef FILNSIZE
  131. #ifdef MAXNAMLEN
  132. #define FILNSIZE MAXNAMLEN
  133. #else
  134. #define FILNSIZE        256     /* -- max filename length -- */
  135. #endif
  136. #endif
  137.  
  138. #ifndef    MAXPATHLENGTH
  139. #ifdef MAXPATHLEN
  140. #define MAXPATHLENGTH MAXPATHLEN
  141. #else
  142. #define MAXPATHLENGTH    1024
  143. #endif
  144. #endif
  145.  
  146. #ifndef MAXFORK
  147. #define MAXFORK         10      /* -- no. of times to try a fork() -- */
  148. #endif
  149.  
  150. #ifndef NULLCP
  151. #define NULLCP          ((char *)0)
  152. #define NULLVP          ((char **)0)
  153. #endif
  154.  
  155. #ifndef NULLFILE
  156. #define NULLFILE        ((FILE *)0)
  157. #endif
  158.  
  159. /* utctime stuff */
  160.  
  161. extern UTC    time_t2utc ();
  162. extern time_t    utc2time_t ();
  163. extern UTC    utcdup ();
  164. extern UTC     utcnow ();
  165.  
  166. #define LOCK_FLOCK    0
  167. #define LOCK_FCNTL    1
  168. #define LOCK_FILE    2
  169. #define LOCK_LOCKF    3
  170.  
  171. extern FILE    *flckopen ();
  172. extern int    flckclose ();
  173.  
  174. /* tailoring */
  175. #define TAI_NONE    0000
  176. #define TAI_LOGS    0001
  177. #define TAI_SIGNALS    0002
  178. #define TAI_ALL        (TAI_LOGS|TAI_SIGNALS)
  179.  
  180. #ifdef SYS5
  181. #define killpg(pid,sig)     kill(-(pid), (sig))
  182. #endif
  183.  
  184. #ifndef HAS_FSYNC
  185. #if defined(BSD42) || defined(SVR4) 
  186. #define HAS_FSYNC
  187. #endif
  188. #endif
  189.  
  190. #endif
  191.